Next | Prev | Up | Top | Contents | Index
Opening Input Devices
An input device is opened at one of two times: when the X server starts up, and when an X client requests an open.
Starting Up the Server
When Xsgi starts up, it opens each device name in /dev/input and for each one it:
- Loads a STREAMS module that has the same name as the name of the device special file, and pushes it onto the stream from the device, below the shmiq multiplexor.
The STREAMS module may be loadable, and most IDEV modules are loadable.
- Looks for a file in /usr/lib/X11/input/config having the same name as the module. The device controls in that file are sent down the stream as IOCTL messages.
The format of device controls is discussed under "Device Controls".
- Asks the device to describe itself. This is done by sending down an IOCTL message of the type IDEVDESC. The module must return the IOCTL message with descriptive data.
The IDEV IOCTL structures are declared in /usr/include/sys/idev.h. A key element of the device description is the X name of the input device.
- Looks for a file in /usr/lib/X11/input/config having the X name of the device as returned in the device description. The X init controls in this file are processed by the X server.
The format of X init controls is discussed under "Device Controls".
- Unless autostart was specified for this device, the device is closed.
Opening from a Client
An X application can use the XListInputDevices() function to get a list of available input devices. Then it can call XOpenDevice() to open a selected device, so that input events from that device will be processed by the X server (see the XListInputDevices(3X) and XOpenDevice(3X) reference pages).
When XOpenDevice() is called for an input device that is not already open, it repeats the process done at startup time:
- Loads the STREAMS module and pushes it on the device stream, feeding the shmiq multiplexor.
- Sends device controls from a file in /usr/lib/X11/input/config having the same name as the module.
- Asks the device (module) to describe itself, including the X name of the device.
- Processes X init controls from a file in /usr/lib/X11/input/config having the X name of the device.
Next | Prev | Up | Top | Contents | Index